<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<body>
<script>
test(function(t) {
    var ctx = document.createElement('canvas').getContext('2d');
    
    ctx.fillStyle = 'green';
    ctx.fillRect(0, 0, 100, 100);
    
    var gradient = ctx.createLinearGradient(0, 0, 0, 100);
    gradient.addColorStop(1, 'red');
    ctx.fillStyle = gradient;
    
    ctx.fill();
    
    var imageData = ctx.getImageData(1, 1, 98, 98);
    var imgdata = imageData.data;
    assert_equals(imgdata[4], 0);
    assert_equals(imgdata[5], 128);
    assert_equals(imgdata[6], 0);
    
    ctx.strokeStyle = 'green';
    ctx.lineWidth = 100;
    ctx.strokeRect(50, 0, 100, 100);
    
    ctx.strokeStyle = gradient;
    
    ctx.stroke();
    
    imageData = ctx.getImageData(1, 1, 98, 98);
    imgdata = imageData.data;
    assert_equals(imgdata[4], 0);
    assert_equals(imgdata[5], 128);
    assert_equals(imgdata[6], 0);
}, "Series of tests to ensure that no gradient is drawn without path");
</script>
</body>
